﻿using AMAP.Domain;
using AMAP.ServiceClasses.Common;
using AMAP.ServiceInterfaces;
using AMAP.ServiceInterfaces.Common;
using System.Linq;

namespace AMAP.ServiceClasses
{
    public class ClientService : BaseRepositoryService<Client>, IClientService
    {
        public ClientService(IDatabaseFactory databaseFactory)
            : base(databaseFactory)
        {
        }

        public override Client Create()
        {
            Client c = new Client();
            c.User = new User();

            return c;
        }

        public Client GetByEmail(string Email)
        {
            return this.dataContext.ClientSet.FirstOrDefault(c => c.User.Email == Email);
        }
    }
}
